<template>
  <a-config-provider :locale="locale">
    <div id="app" style="width: 1900px;height: 937px">
      <router-view style="height:100%"/>
    </div>
  </a-config-provider>
</template>

<script>
import { domTitle, setDocumentTitle } from '@/utils/domUtil'
import { i18nRender } from '@/locales'

export default {
  data () {
    return {
    }
  },
  computed: {
    locale () {
      // 只是为了切换语言时，更新标题
      const { title } = this.$route.meta
      title && (setDocumentTitle(`${i18nRender(title)} - ${domTitle}`))

      return this.$i18n.getLocaleMessage(this.$store.getters.lang).antLocale
    }
  },
  mounted() {
    this.resize()
    window.onresize = ()=>{
      this.resize()
    }
  },
  methods:{
    resize(){
      document.getElementById('app').style.transform = `scale(1)`
      document.getElementById('app').style.transformOrigin = `0 0`
      document.getElementById('app').style.height = `100%`
      setTimeout(()=>{
        var scale = (window.innerWidth-20)/1900
        document.getElementById('app').style.transform = `scale(${scale})`
        document.getElementById('app').style.transformOrigin = `0 0`
        document.getElementById('app').style.height = `${100/scale}%`
      },0)

    }
  }
}
</script>
